<?php
namespace app\client\controller;

use think\Url;
use think\Request;
use think\Session;
use think\Controller;
use app\client\model\Shop as ShopModel;
use app\client\model\Config as ConfigModel;

class Config extends Controller
{

    /*
     * 店铺
     */
    public function index()
    {

        if (Request::instance()->isPost()) {

            $data = Request::instance()->param();

            // 提交数据
            $dispose = (new ConfigModel())->allowField(true)->save($data, ['member_id' => Session::get('shop_id')]);

            if ($dispose) {
                win('操作成功', Url::build('Config/index'));
            }

            fail('操作失败');

        }

        $data = ShopModel::get(['member_id' => Session::get('shop_id')]);
        return $this->fetch('', [
            "mate_title" => '配置信息',
            "item"       => $data
        ]);
    }
}
